﻿using Abp.Application.Services;
using Abp.Application.Services.Dto;
using Abp.Domain.Repositories;
using Abp.ObjectMapping;
using CPPProject.CppModel;
using CPPProject.CppServices.Dto;
using Microsoft.EntityFrameworkCore;
using OplugAbpProject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace CPPProject.CppServices
{
    public class T_Biz_AppCustomerAppService : AsyncCrudAppService<T_Biz_AppCustomer, T_Biz_AppCustomerDto, Guid, PagedResultRequestDto, UpdateT_Biz_AppCustomerDto, UpdateT_Biz_AppCustomerDto>,IT_Biz_AppCustomerAppService
    {
        private readonly IObjectMapper _objectMapper;
        public T_Biz_AppCustomerAppService(IRepository<T_Biz_AppCustomer, Guid> repository, IObjectMapper objectMapper) : base(repository)
        {
            _objectMapper = objectMapper;
        }
        /// <summary>
        /// 企业资质审核
        /// </summary>
        /// <param name="nCompanyID">公司ID</param>
        /// <param name="skipCount"></param>
        /// <param name="maxResultCount"></param>
        /// <param name="query">查询条件（公司名称、注册人）</param>
        /// <returns></returns>
        //public async Task<pageDto> GetList(string nCompanyID , int maxResultCount, int skipCount = 0,  string query = "")
        //{
        //    List<dompanyauditDto> result = new List<dompanyauditDto>();
        //    pageDto pageDto = new pageDto();
        //    Expression<Func<T_Biz_AppCustomer, bool>> expr = o => o.NCompanyID == nCompanyID;

        //    if (!string.IsNullOrEmpty(query))
        //    {

        //        expr = expr.ExpressionAnd(o => o.CCompanyName == query || o.CCreator == query);
        //    }

        //    var lists = await Repository.GetAll().OrderByDescending(o => o.CCreateTime).Where(expr).ToListAsync();
        //    foreach (var item in lists)
        //    {
        //        var list2 = await _CustomerRegistAppService.GetByCuserID(item.CUserID.ToString(), nCompanyID);//去CustomerRegist表查
        //        dompanyauditDto dto = new dompanyauditDto();
        //        dto.CCompanyName = item.CCompanyName;
        //        dto.CCreator = item.CCreator;
        //        dto.AuditDate = item.AuditDate;
        //        dto.CPhone = list2.CPhone;
        //        dto.CType = item.CType;
        //        dto.Id = item.Id.ToString();
        //        result.Add(dto);
        //    }
        //    var dtos = result.Skip(skipCount).Take(maxResultCount).ToList();
        //    pageDto.count = result.Count;
        //    pageDto.Dto = dtos;
        //    return pageDto;
        //}
    }
}
